//
//  HKWebViewController.m
//  HKTimeKitApp
//
//  Created by huzhaoke1 on 2023/5/13.
//

#import "HKWebViewController.h"
#import "GifImageView.h"
#import<WebKit/WebKit.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <Reachability/Reachability.h>
#import "UIView+properties.h"
#import "HKCommonDefine.h"
#import "HKUser.h"
#import "HTTPURL.h"
#import "HKHeartBeatViewController.h"
#import "HKRequestDefine.h"
#import "HKLoadingView.h"
#import "HKToastView.h"
#import "HKCalendarAndLocalNotificationHandler.h"
#import "HKAvVideoRecorder.h"
#import "HKWebViewContainer.h"
#import "HKLoadingView.h"

@interface HKWebViewController ()

@end

@implementation HKWebViewController
-(void)viewWillAppear:(BOOL)animated{
    [self preferredStatusBarStyle];
    [HKUITool setStatusBarBackgroundColor:[UIColor whiteColor]];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.userDefinedNaviBar.hidden = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    self.webViewContainer.wkWebView.frame = self.view.bounds;
    [self.view addSubview:self.webViewContainer.wkWebView];
    if (!self.webViewContainer.hasFinishLoading) {
        [[HKLoadingView loadingView] showLoading];
    }
    [self.webViewContainer setFinishBlock:^(BOOL isFinish) {
        [[HKLoadingView loadingView] hideLoading];
    }];
}

- (HKWebViewContainer *)webViewContainer{
    if (!_webViewContainer){
        _webViewContainer = [[HKWebViewContainer alloc] init];
    }
    return _webViewContainer;
}

-(void)loadingRequestWithUrl:(NSString *)url {
    if (url.length == 0) return;
    [self.webViewContainer loadingRequestWithUrl:url];
}

//- (void)setWebViewContainer:(HKWebViewContainer *)webViewContainer {
//    _webViewContainer = webViewContainer;
//    [webViewContainer setFinishBlock:^(BOOL isFinish) {
//        [[HKLoadingView loadingView] hideLoading];
//    }];
//}

@end
